<?php defined('_VALID_MOS') or die('Direct Access to this location is not allowed.'); ?>

<form action="index2.php" method="post" name="adminForm">
    <table cellpadding="4" cellspacing="0" border="0" width="100%">
        <tr>
            <td width="50%" class="sectionname">Events</td>
            <td width="50%" nowrap="nowrap">
                <fieldset>
                    <legend>When/What/Who</legend>
                    <input class="inputbox" type="text" name="event_minute" size="5" value="" />
                    <?php echo mosHTML::selectList($this->players, "event_playermap", 'class="inputbox" size="1" style="width:200px"', 'value', 'text', 0); ?>
                    <?php echo mosHTML::selectList($this->eventtypes, "event_type", 'class="inputbox" size="1" style="width:200px"', 'value', 'text', 0); ?>
                    <input type="button" name="" class="button" value="add" onClick="javascript:submitbutton('quickadd');" />
                </fieldset>
            </td>
        </tr>
    </table>

    <table class="adminlist">
        <tr>
            <th width="1%">
                <input type="checkbox" name="toggle" value="" onclick="checkAll(<?php echo count($this->rows); ?>);" />
            </th>
            <th width="4%" align="left" nowrap="nowrap">Time</th>
            <th width="15%" align="left" nowrap="nowrap">Eventtype</th>
            <th width="10%" align="center" nowrap="nowrap">Team</th>
            <th width="20%" align="left" nowrap="nowrap">Player</th>
            <th width="20%" align="left" nowrap="nowrap">Notice</th>
            <th width="30%" align="center" nowrap="nowrap" >Text</th>
        </tr>
        <?php
        $k = 0;
        $i = 0;
        foreach ($this->rows AS $row) {
            
            $eventtype = LM_Eventtypemap::getEventtype($row->event_type);

            $team = LM::getLMTable('Team');
            $team->load($row->team_id);

            $k = 1 - $k;
        ?>
            <tr class="<?php echo "row$k"; ?>">
                <td>
                    <input type="checkbox" id="cb<?php echo $i; ?>" name="cid[]" value="<?php echo $row->event_id; ?>" onclick="isChecked(this.checked);" />
                </td>
                <td align="center">
                    <a href="#edit" onclick="return listItemTask('cb<?php echo $i; ?>','edit')">
                        <?php echo $row->event_minute; ?>
                    </a>
                </td>
                <td align="left"><?php echo $eventtype->getName(); ?></td>
                <td align="center">
                    <?php if ($team->getLogo() !== ''): ?>
                    <?php $this->plugin("thumb", "logos", $team->getLogo(), 28, 28); ?>
                    <?php else: ?>
                    <?php echo $team->getShortName(); ?>
                    <?php endif ?>
                </td>
                <td align="left"><a href="index2.php?option=com_leagueman&act=playermap&task=edit&id=<?php echo $row->playermap_id; ?>"><?php echo $row->player_name; ?></a></td>
                <td align="left"><?php echo $row->event_text_short; ?></td>
                <td align="left"><?php echo substr($row->event_text, 0, 50) . "..."; ?>&nbsp;</td>
            </tr>
        <?php
                        $i++;
                    } ?>
    </table>

    <input type="hidden" name="option" value="com_leagueman" />
    <input type="hidden" name="act" value="events" />
    <input type="hidden" name="task" value="" />
    <input type="hidden" name="boxchecked" value="0" />
</form>